#region File Description
//-----------------------------------------------------------------------------
// MainMenuScreen.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion

#region Using Statements
using Microsoft.Xna.Framework;
using kinect_music_shooter.Screens;
#endregion

namespace kinect_music_shooter
{
    /// <summary>
    /// The main menu screen is the first thing displayed when the game starts up.
    /// </summary>
    class MainMenuScreen : MenuScreen
    {
        #region Initialization

        /// <summary>
        /// Constructor fills in the menu contents.
        /// </summary>
        public MainMenuScreen()
            : base("Main Menu")
        {            
            // Create our menu entries.
            MenuEntry playGameMenuEntry = new MenuEntry("Play Game");
            MenuEntry optionsMenuEntry = new MenuEntry("Options");
            MenuEntry exitMenuEntry = new MenuEntry("Exit");

            MenuEntry christianMenuEntry = new MenuEntry("Christian");
            MenuEntry calibrateMenuEntry = new MenuEntry("Kinect Kalibrieren");
            MenuEntry danielMenuEntry = new MenuEntry("Daniel");
            MenuEntry highscoreMenuEntry = new MenuEntry("Highscore");
            MenuEntry songsMenuEntry = new MenuEntry("Song-Selection");

            // Hook up menu event handlers.
            playGameMenuEntry.Selected += PlayGameMenuEntrySelected;
            optionsMenuEntry.Selected += OptionsMenuEntrySelected;
            exitMenuEntry.Selected += OnCancel;
            
            christianMenuEntry.Selected += ChristianMenuEntrySelected;
            calibrateMenuEntry.Selected += calibrateMenuEntrySelected;
            danielMenuEntry.Selected += DanielMenuEntrySelected;
            highscoreMenuEntry.Selected += highscoreMenuEntrySelected;
            songsMenuEntry.Selected += songsMenuEntrySelected;

            // Add entries to the menu.
            MenuEntries.Add(playGameMenuEntry);
            //MenuEntries.Add(optionsMenuEntry);
            //MenuEntries.Add(calibrateMenuEntry);           
            MenuEntries.Add(highscoreMenuEntry);
            MenuEntries.Add(exitMenuEntry);
        }


        #endregion

        #region Handle Input

        /// <summary>
        /// Event handler for when the Play Game menu entry is selected.
        /// </summary>
        void PlayGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            //LoadingScreen.Load(ScreenManager, true, e.PlayerIndex, new GameplayScreen());
            ScreenManager.AddScreen(new LisaMenuScreen("", 0), e.PlayerIndex);
        }


        /// <summary>
        /// Event handler for when the Options menu entry is selected.
        /// </summary>
        void OptionsMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            ScreenManager.AddScreen(new OptionsMenuScreen(), e.PlayerIndex);
        }


        /// <summary>
        /// When the user cancels the main menu, ask if they want to exit the sample.
        /// </summary>
        protected override void OnCancel(PlayerIndex playerIndex)
        {
            ScreenManager.Game.Exit();

            //const string message = "Are you sure you want to exit this sample?";

            //MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(message);

            //confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted;

            //ScreenManager.AddScreen(confirmExitMessageBox, playerIndex);
        }


        /// <summary>
        /// Event handler for when the user selects ok on the "are you sure
        /// you want to exit" message box.
        /// </summary>
        void ConfirmExitMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
        {
            ScreenManager.Game.Exit();
        }


        /// <summary>
        /// Event handler for when the Christian menu entry is selected.
        /// </summary>
        void ChristianMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            ScreenManager.AddScreen(new ChristianMenuScreen(), e.PlayerIndex);
        }

        /// <summary>
        /// Event handler for when the Calibrate menu entry is selected.
        /// </summary>
        void calibrateMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            ScreenManager.AddScreen(new CalibrateMenuScreen(), e.PlayerIndex);
        }

        /// <summary>
        /// Event handler for when the Daniel menu entry is selected.
        /// </summary>
        void DanielMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            ScreenManager.AddScreen(new DanielMenuScreen(), e.PlayerIndex);
        }

        /// <summary>
        /// Event handler for when the Highscore menu entry is selected.
        /// </summary>
        void highscoreMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            ScreenManager.AddScreen(new HighscoreMenuScreen(), e.PlayerIndex);
        }

        void songsMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            ScreenManager.AddScreen(new LisaMenuScreen("", 0), e.PlayerIndex);
        }

        #endregion
    }
}
